package com.ymatou.iapi.reachpromotion.service;

import org.json.JSONObject;

import com.ymatou.iapi.reachpromotion.parameter.GetMultiProductPromotionPolicyResp;
import com.ymatou.iapi.reachpromotion.parameter.GetSingleProductPromotionPolicyRes;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*获取买手商品促销策略信息Call
*FreeMaker Template自动生成代码
*/
public class GetProductPromotionPolicyCall extends YmatouBaseCall{
	private static String opurl ="api/promotion/GetProductPromotionPolicy";
	
	public GetProductPromotionPolicyCall() {
		super(EnvSetup.getSystemUrl("reachpromotion"),opurl,"GET","PARAM");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public String getCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Code");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	public String getBCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("BCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	public String getMsg() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Msg");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	public String getData() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Data");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	
	public GetSingleProductPromotionPolicyRes getSingleProductPromotionPolicyRes()
	{
		GetSingleProductPromotionPolicyRes data = null;
        try {
            data = (GetSingleProductPromotionPolicyRes) FormatUtil.GSONToObject(getData(), GetSingleProductPromotionPolicyRes.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
	}
}